package com.dg.cuckoo.admin.action.compilation;

import com.dg.cuckoo.admin.dto.projectInfo.ProjectLogDto;
import com.dg.cuckoo.admin.service.CompletedService;
import com.dg.cuckoo.common.utils.PageModel;
import com.dg.cuckoo.core.BaseController;
import com.dg.cuckoo.core.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 制度汇编-竣工决算
 */
@RestController
@RequestMapping("/compilation/completed")
public class Completed extends BaseController {

    @Autowired
    private CompletedService service;

    /**
     * 新增 save
     */
    @PostMapping("save")
    public JsonResult<Void> save(ProjectLogDto dto, MultipartFile[]files) throws Exception {
        service.save(dto,files);
        return new JsonResult<>(OK);
    }

    /**
     * 分页
     * @param page 页
     * @param pageSize 页数
     * @return
     */
    @PostMapping("page/{page}/{pageSize}")
    public JsonResult<PageModel> page(@PathVariable Integer page, @PathVariable Integer pageSize){
        PageModel data = service.page(page, pageSize);
        return new JsonResult<>(OK,data);
    }

    /**
     * 修改
     */
    @PostMapping("updata/{id}")
    public JsonResult<Void> updata(@PathVariable String id,ProjectLogDto dto,MultipartFile[]files) throws Exception {
        service.updata(id,dto,files);
        return new JsonResult<>(OK);
    }

    /**
     * 删除 用项目信息-项目日志的删除接口
     */


    /**
     * 查询 用项目信息-项目日志的点击序号显示所有项目日志所有信息接口
     */
}
